<%@ page language="java" pageEncoding="UTF-8"%>  
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ include file="../header.jsp"%>
<jsp:include page="../js.jsp"/>
<div class="content-wrapper" style="font-family: '微软雅黑';">
<input type="hidden" id="ctx" value="<%=request.getContextPath()%>"/>
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      ${module } <small>Control panel</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href=""><i class="fa fa-dashboard"></i>主页</a></li>
      <li class="active">经纪人服务数据报表</li>
    </ol>
  </section>
  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
          <div>  
    <div>
        订单开始时间： <input type="text" id="start_time"/>
        订单结束时间： <input type="text" id="end_time"/>
        经纪人手机号： <input type="text" id="phone"/>
    </div>
    <div>
        经纪人真实姓名： <input type="text" id="realname"/>
        城市： <input type="text" id="city"/>
        <input type="button" onclick="search1()"  value="查询">  
        <input type="button" onclick="excelExport()"  value="导出为Excel">  
    </div>
    </div>  
          </div>
          <!-- /.box-header -->
          <div class="box-body">
<table id="example" class="display">
        <thead>
            <tr style="background-color: #97CBFF;color: white">
                  <th>经纪人手机号</th>
                  <th>经纪人真实姓名</th>
                  <th>经纪人昵称</th>
                  <th>城市</th>
                  <th>服务单数</th>
                  <th>差评数</th>
                  <th>中评数</th>
                  <th>好评数</th>
                  <th>预奖励金额</th>
            </tr>
        </thead>
 
        <tbody>
			<tr>
				
			</tr>
        </tbody>
    </table>
    </div>
          <!-- /.box-body -->
        </div>
        <!-- /.box -->
      </div>
      <!-- /.col -->
    </div>
    <!-- /.row -->
    <!--  显示下面的分页控件  -->
  </section>
  <!-- /.content -->
</div>
<script type="text/javascript">
$('#start_time').datetimepicker({lang:'ch',timepicker:true});
$('#end_time').datetimepicker({lang:'ch',timepicker:true});


var table;
$(document).ready(function() {
	table= $('#example').DataTable( {  
	        "pagingType": "simple_numbers",//设置分页控件的模式  
	         searching: false,//屏蔽datatales的查询框  
	         aLengthMenu:[10,50,100],//设置一页展示10条记录  
	         "bLengthChange": true,//屏蔽tables的一页展示多少条记录的下拉列表  
	         "oLanguage": {  //对表格国际化  
	            "sLengthMenu": "每页显示 _MENU_条",    
	            "sZeroRecords": "没有找到符合条件的数据",    
	        //  "sProcessing": "&lt;img src=’./loading.gif’ /&gt;",    
	            "sInfo": "当前第 _START_ - _END_ 条　共计 _TOTAL_ 条",    
	            "sInfoEmpty": "木有记录",    
	            "sInfoFiltered": "(从 _MAX_ 条记录中过滤)",    
	            "sSearch": "搜索：",    
	            "oPaginate": {    
	            "sFirst": "首页",    
	            "sPrevious": "前一页",    
	            "sNext": "后一页",    
	            "sLast": "尾页"    
	                   
	            }    
	        },  
	    "processing": true, //打开数据加载时的等待效果  
	        "serverSide": true,//打开后台分页  
	        "ajax": {  
	            "url":$('#ctx').val()+"/data/broker/page",   
	            "dataSrc": "aaData",   
	            "data": function ( d ) {  
	                var start_time = $('#start_time').val();  
	                var end_time = $('#end_time').val();  
	                var phone = $('#phone').val();  
	                var realname = $('#realname').val();  
	                var city = $('#city').val();  
	                //添加额外的参数传给服务器  
	                d.start_time = start_time;  
	                d.end_time = end_time;  
	                d.phone = phone;  
	                d.realname = realname;  
	                d.city = city;  
	            } 
	       
	        } ,  
	        "columns": [  
	            { "data": "telephone" },  
	            { "data": function(obj){
	            	if(obj.real_name==null||obj.real_name==''){
	            		return "<font color='red'>未实名</font>";
	            	}else{
	            		return obj.real_name;
	            	}
	            } },  
	            { "data": "username" },  
	            { "data": "cityname" },
	            { "data": "orderCount" },  
	            { "data": "minEvaluateCount" },  
	            { "data": "midEvaluateCount" },  
	            { "data": "maxEvaluateCount" },  
	            { "data": function(obj){
	            	if(obj.orderCount<100){
	            		return parseInt(obj.orderCount/10)*50;
	            	}else if(obj.orderCount>=100){
	            		return 600;
	            	}
	            }}
	        ]  
	      
	    } );  
	} );  
	
function search1()  
{  
	table.ajax.reload();  
} 
function excelExport()  
{  
	var start_time = $('#start_time').val();  
    var end_time = $('#end_time').val();  
    var phone = $('#phone').val();  
    var realname = $('#realname').val();  
    var city = $('#city').val();  
    
    window.location.href=$('#ctx').val()+"/data/broker/excel/export?start_time="+start_time
    		+"&end_time="+end_time
    		+"&phone="+phone
    		+"&realname="+realname
    		+"&city="+city
    		;
   
} 




</script>

<%@ include file="../footer.jsp"%>





